﻿<Window x:Class="Blackbird.Editors.FramesetEditorWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="FramesetEditorWindow">
  <Window.Resources>
    <DataTemplate x:Key="EditableFrameTemplate">
      <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Path=Index}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
        <Border BorderThickness="2" BorderBrush="Black" Margin="6.0" CornerRadius="6, 6, 0, 0">
          <Image Source="{Binding Path=BitmapSource}" Margin="2.0"></Image>
        </Border>
      </StackPanel>
    </DataTemplate>

  </Window.Resources>
  <Grid Background="{StaticResource MetalGradient}">
    <Grid.RowDefinitions>
      <RowDefinition Height="48px" />
      <RowDefinition MinHeight="128px" />
      <RowDefinition Height="48px" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Name="SelectorColumn" Width="256px" />
      <ColumnDefinition Name="FrameColumn" MinWidth="256px" />
    </Grid.ColumnDefinitions>
    <StackPanel Grid.RowSpan="2">
      <Border Name="ItemHeaderBorder" Style="{StaticResource HeaderBorderStyle}">
        <TextBlock Name="FrameItemsHeaderText" HorizontalAlignment="Center" VerticalAlignment="Center"
                   Text="{Binding Frameset, Path=Name}" Height="35px" />
      </Border>
      <Border Name="FramesetToolbarBorder" Style="{StaticResource ToolsBorderStyle}" VerticalAlignment="Bottom"
              Height="35px">
        <ToolBarTray Background="Transparent" Orientation="Horizontal">
          <ToolBar Background="Transparent">
            <Button>
              <Image Source="{StaticResource AddFileImage}" Width="24" />
            </Button>
            <Button>
              <Image Source="{StaticResource DeleteImage}" Width="24" />
            </Button>
          </ToolBar>
        </ToolBarTray>
      </Border>

      <Border Style="{StaticResource ListBorderStyle}">
        <ScrollViewer VerticalAlignment="Center">
          <StackPanel>
            <ListBox Name="FrameItemsListBox" ItemTemplate="{StaticResource EditableFrameTemplate}" MinHeight="128px"></ListBox>
          </StackPanel>
        </ScrollViewer>
      </Border>
    </StackPanel>
    <GridSplitter Grid.Column="0" HorizontalAlignment="Right" Grid.RowSpan="2" VerticalAlignment="Stretch" Width="2px"
                  Background="LightBlue" ShowsPreview="True" />
    <Button Grid.Row="2" Name="SampleButton" Content="Sample" Style="{StaticResource PaperButtonStyle}"
            Click="SampleButtonClick" />
    <Border BorderBrush="Black" BorderThickness="2" Grid.Column="1" Grid.RowSpan="2" HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch">
      <Grid Background="Transparent">
        <Grid.RowDefinitions>
          <RowDefinition Name="DisplayRow" />
          <RowDefinition Name="ControlRow" Height="32px" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Name="DisplayColumn" />
          <ColumnDefinition Name="ToolsColumn" Width="60px" />
        </Grid.ColumnDefinitions>
        <Border Grid.Row="0" Grid.Column="0" Background="DarkGray" BorderBrush="Black" Margin="8px" Padding="15px"
                CornerRadius="8" MinHeight="200px">
          <Image Name="DisplayImage" MinWidth="128px" MinHeight="128px" HorizontalAlignment="Center"
                 VerticalAlignment="Center" Source="{Binding Path=SelectedFrame.BitmapSource}"></Image>
        </Border>
        <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="100" />
              <ColumnDefinition Width="40" />
              <ColumnDefinition Width="50" />
              <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Button Name="UpdateFrameButton" Style="{StaticResource PaperButtonStyle}" HorizontalAlignment="Right"
                    Click="UpdateFrameButtonClick" Content="Change Image"></Button>
            <TextBlock Text="Fps:" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"
                       Margin="0, 0, 4, 0" />
            <TextBox Text="{Binding Path=Fps}" Grid.Column="2" Margin="2, 2, 2, 2" HorizontalAlignment="Stretch"
                     HorizontalContentAlignment="Left" TextAlignment="Left" />
          </Grid>

        </Border>
        <Border Grid.Column="1" Style="{StaticResource ToolsBorderStyle}">
          <ToolBarTray Orientation="Vertical" Background="Transparent">
            <ToolBar Name="ImageControlToolbar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                     Background="Transparent">
              <Button Name="RotateLeftButton">
                <Image Source="{StaticResource RotateFrameClockwiseImage}" Width="32" />
              </Button>
              <Button Name="RotateRightButton">
                <Image Source="{StaticResource RotateFrameCounterClockwiseImage}" Width="32" />
              </Button>
              <Button Name="Magnify">
                <Image Source="{StaticResource MagnifyFrameImage}" Width="32" />
              </Button>
            </ToolBar>
          </ToolBarTray>
        </Border>
      </Grid>
    </Border>
  </Grid>
</Window>